import * as types from '../actionTypes';

const initState = {
  value: 'day06',
  message: 'msg',
  code: 0,
  isFetching: false
}

export default (state = initState, action) => {
  switch (action.type) {
    case types.AUTH_REQUEST:
      return {
        ...state,
        isFetching: true
      }
    case types.AUTH_SUCCESS:
      {
        return {
          ...state,
          ...action.data,
          isFetching: false
        }
      }
    case types.AUTH_FAILED:
      return {
        ...state,
        ...action.data,
        isFetching: false
      }
    default:
      return state;
  }
}
